import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "DBshop007销售管理-发货单"

dr=openBrowser(urlAdmin) #调用函数打开指定网址,并且获取函数的返回值,函数返回的是浏览器的对象
DBshopLoginAdmin(dr) #调用函数登录dbshop的后台
DBshopEnterMenu2(dr,'销售管理','发货单')
rootPath=get_pro_rootpath() #获取项目的绝对路径
filePath=rootPath+r'\public\orderID.txt' #拼接文件路径
orderNo=readFile(filePath) #读取文件中的订单编号
# //td[text()="1664356244570063"]
# aa=dr.find_element_by_xpath('//td[text()="%s"]'%orderNo).is_displayed()
# print(aa)
dr.find_element_by_xpath('//td[text()="%s"]/following-sibling::td[5]/a'%orderNo).click()
time.sleep(4)
s=dr.find_element_by_xpath("//body").text
l="订单号"+orderNo+"  "
r="\)"
order_State=reGetString(s,l,r)
print(order_State) #order_State 是实际值
yuqi="已收货"  #这是预期值
#检查点
if yuqi==order_State:
    writeLog("%s 测试通过" % testCase)
else:
    writeLog("%s 测试不通过" % testCase)
    getPhoto(dr)
dr.quit()